<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	template="/template/template.xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.prime.com.tr/ui">

	<ui:define name="title">Perfis</ui:define>

	<ui:define name="menu">
		<ui:include src="/facelets/user/user_menu.xhtml" />
	</ui:define>

	<ui:define name="content">
		<p:growl id="msgs" />
		<p:panel header="Perfis">
			<br />
			<p:focus for="profileName"></p:focus>
			<h:panelGrid columns="3" cellpadding="5">
				<label>Nome: </label>
				<p:inputText id="profileName" value="#{profileMB.name}" title="Nome da permissão" />
				<p:commandButton action="#{profileMB.filter}"
					ajax="false" image="ui-icon ui-icon-search" title="Pesquisar"
					value="Pesquisar">
				</p:commandButton>
			</h:panelGrid>
			<br />
			<p:dataTable var="profile" value="#{profileMB.profiles}"
				paginator="true" rows="7">

				<p:column>
					<f:facet name="header">
						<h:outputText value="Nome" />
					</f:facet>
					<h:outputText value="#{profile.name}" />
				</p:column>

				<p:column style="width:70px" colspan="2">
					<f:facet name="header">
						<h:outputText value="Ações" />
					</f:facet>
					<p:commandButton action="profileInsert"
					actionListener="#{profileMB.edit}"
						ajax="false" title="Editar" image="ui-icon ui-icon-pencil">
						<f:param id="profileEdit" value="#{profile}"></f:param>
					</p:commandButton>
					<p:commandButton action="profileSearch" 
						rendered="#{loginMB.profileDeleter}"
						actionListener="#{profileMB.delete}"
						ajax="false" image="ui-icon ui-icon-trash" title="Excluir">
						<f:param id="profileDelete" value="#{profile}"></f:param>
					</p:commandButton>
				</p:column>

			</p:dataTable>

			<h:panelGrid columns="1" cellpadding="5">
				<p:commandButton value="Novo" immediate="true"
					rendered="#{loginMB.profileCreator}"
					image="ui-icon ui-icon-plus" ajax="false"
					action="profileInsert" title="Adicionar" />
			</h:panelGrid>

		</p:panel>
	</ui:define>

</ui:composition>